﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

namespace FacialClub.Models.Library
{
    public class SendEmailLibrary
    {
        public bool SendMail(string receiverName,string receiverEmail, string senderName, string senderEmail, string subject, string body)
        {
            try
            {
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.To.Add(new MailAddress(receiverEmail,receiverName));
                msg.From = new MailAddress(senderEmail,senderName);
                msg.Subject = subject;
                msg.Body = body.Replace("{ReceiverEmail}", receiverEmail).Replace("{ReceiverName}", receiverName).Replace("{SenderEmail}", senderEmail).Replace("{SenderName}", senderName);
                SmtpClient client = new SmtpClient("mail.corp.salu.com");
                client.Send(msg);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}